<?php

if (!defined('_PAGE_'))
    include _FLEP_LIB_DIR_.'/page.inc';

$css = array( 'main.css', 'add_estudiante.css');
$javascript = array('common.js', 'search.js');

flep_structure($structure, 'nivel');
$structure['data'][0]['id'] = false;
if(isset($_GET['id'])){
    $structure['data'][0]['id'] = $_GET['id'];
}


function include_page($structure){
if($edit = $structure['data'][0]['id']){
    $structure['where'][0] = sprintf("`niveles`.`id`='%s'", flep_decode($structure['data'][0]['id']));
    flep_search_all($structure);
}
?>
<h3><a href="main.php?page=nivel">Niveles</a></h3>
    <br>
    <div class="menu">
        <a href="?page=add_nivel">Nuevo Nivel</a>&nbsp;|&nbsp;
        <a href="?page=curso">Cursos</a>&nbsp;|&nbsp;
        <?php flep_page_search($structure); ?>
    </div>
    <br><br>
    <p class="error" id="perror"></p>
    <form action="store.php?type=nivel" method="POST" id="form_nivel">
        <input type="hidden" value="<?php echo ($edit?flep_encode($structure['data'][0]['id']):'')?>" id="id" name="id">
        <table>
            <tr>
                <td><label>Nivel:</label></td>
                <td><input type="text" autofocus name="nivel" style="width: 250px" value="<?php echo ($edit?$structure['data'][0]['nivel']:'')?>" required placeholder="Nivel"></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="submit" value="Guardar" style="margin-right: 100px;"><input type="reset" value="Limpiar"></td>
            </tr>
        </table>
    </form>
<?php
}

function include_menu(){
    include_main_menu();
}

?>

